home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1995 October / EnigmA AMIGA RUN 01 (1995)(G.R. Edizioni)(IT)[!][issue 1995-10][Aminet 7].iso / Aminet / comm / fido / Bundle_Spot.lha / BUNDLE.spot next >
Text File  |  1995-04-29  |  28KB  |  860 lines

  1.             /*************************************************/
  2.             /****************BUNDLE.spot V 1.3****************/
  3.             /*************************************************/
  4.  
  5. /*************************************************************************/
  6. /******************* Check for Rexxreqtools.Library***********************/
  7. /*************************************************************************/
  8.  
  9. IF ~ EXISTS("libs:rexxreqtools.library") THEN DO
  10.     SAY "Can't find rexxreqtools.library, aborting.."
  11.     EXIT
  12.     END
  13.  
  14. IF ~ SHOW('L',"rexxreqtools.library") THEN DO
  15.     ADDLIB('rexxreqtools.library',0,-30,0)
  16.     END  
  17.  
  18. /*************************************************************************/
  19. /************************ Initialise some variables***********************/
  20. /*************************************************************************/
  21.  
  22. OPTIONS RESULTS  
  23. NL = '0a'x
  24. STAMP = 0
  25. VAR_STRING = "SPOT_PATH SPOT_CONFIG USER_NAME BOSS_NAME USER_ADDRESS ",
  26.              "BOSS_ADDRESS BBS_NAME BBS_LIST SEARCH_DIR ARCHIVE_NAME ",
  27.              "ARCHIVE_DIR NETMAIL_AREA LOG_NAME"
  28.  
  29. signal on syntax
  30. signal on failure     
  31.  
  32. /**********************************************************************/
  33. /**************** Check for a current prefs file **********************/
  34. /**********************************************************************/
  35.  
  36. IF ~EXISTS('S:BUNDLE.PREFS') THEN DO
  37.         CALL rtezrequest('Can''t find S:BUNDLE.prefs,'NL,
  38.                          'You must first run the Prefs'NL,
  39.                          'editor to create a new prefs file....','OK','Bundle.prefs','rtez_flags = ezreqf_centertext',)
  40.         NEW_PREFS = 1
  41.         SIGNAL MAIN
  42.         END
  43.  
  44. /**********************************************************************/
  45. /************************ Opening requester ***************************/
  46. /**********************************************************************/
  47. COMMENCE:
  48.  
  49. CALL rtezrequest("Welcome to BUNDLE.spot"NL,
  50.                  "What do you want to do ?","BUNDLE|CONFIGURE|ABOUT|QUIT"  ,"Bundle.spot","rtez_flags=ezreqf_centertext",)
  51.  
  52. IF rtresult = 0 THEN DO             /*    "QUIT"   */
  53.               CALL FINISHED
  54.               EXIT
  55.               END
  56. IF rtresult = 1 THEN DO             /* "  BUNDLE"  */
  57.               CALL READ_IN
  58.               CALL stamplog
  59.               STAMP = 1
  60.               END
  61. IF rtresult = 2 THEN DO             /* "CONFIGURE" */
  62.               SIGNAL MAIN_PREFS
  63.               END
  64. IF rtresult = 3 THEN SIGNAL ABOUT   /*   "ABOUT"   */
  65.  
  66. /************************************************************************/
  67. /************** Open any necessary files for Reading/Writing  ***********/
  68. /************************************************************************/
  69.  
  70. CALL OPEN(BBS,PREFS.8,READ)
  71. CALL OPEN(fullpath,'T:fullpath.tmp',WRITE)
  72. CALL OPEN(nopath,'T:nopath.tmp',WRITE)
  73.                                                                         
  74.      
  75.  
  76. /************************************************************************/
  77. /****************  Check for SPOT and Run or Uniconify ******************/
  78. /************************************************************************/
  79.  
  80. IF ~SHOW('PORTS','SPOT') THEN DO
  81. SPOT_EXE =  PREFS.1||"Spot"
  82.   ADDRESS COMMAND
  83.   'RUN 'SPOT_EXE' CONFIGPATH 'PREFS.2
  84.   'WaitForPort SPOT'
  85.   QUIT = YES
  86. END
  87.  
  88. ADDRESS 'SPOT'
  89. 'isiconified'
  90. IF RC = 0 THEN DO
  91.   ICON = YES
  92.   'uniconify'
  93.   END
  94. 'spot2front'
  95. 'lockgui'
  96.  
  97. /************************************************************************/
  98. /**************************  Select the files ***************************/
  99. /************************************************************************/
  100.  
  101. START:
  102. DROP files files. ALL_FILES FILE_SIZE
  103. CALL rtfilerequest(PREFS.9 ,, 'Bundle.spot' ,,'rt_pubscrname = SPOT rtfi_flags = freqf_multiselect', files)
  104.  
  105. IF files = 0 THEN DO
  106.     call rtezrequest("No files selected" , " Abort " , "Bundle.spot.." , "rt_pubscrname=SPOT")
  107.     CALL FINISHED
  108.     SIGNAL COMMENCE
  109.     END
  110.  
  111. IF files == 1 THEN DO
  112.   CALL OPEN('REQ_TEXT','T:ReqText.tmp',WRITE) /* OPEN REQ_TEXT for WRITING  */
  113.   DO i = 1 to files.count
  114.   CALL WRITECH('REQ_TEXT',files.i NL)         /* Write ALL the files to it  */
  115.   DROP files.i
  116.   END
  117.  
  118.  
  119.  
  120.   CALL OPEN('REQ_TEXT','T:ReqText.tmp',READ)  /* OPEN REQ_TEXT for READING  */
  121.   FILE_SIZE = SEEK('REQ_TEXT',0,'END')        /* Get number of CHARS in REQ_TEXT*/
  122.   CALL SEEK('REQ_TEXT',0,'BEGIN')             /* Go to start of REQ_TEXT */
  123.   ALL_FILES = READCH('REQ_TEXT',FILE_SIZE)    /* READ all the characters */
  124.   CALL SEEK('REQ_TEXT',0,'BEGIN')             /* Return to start         */
  125.  
  126.    CALL rtezrequest(ALL_FILES, 'OK|RESELECT|ABORT'  ,  'You picked '||files.count||' files..' ,'rt_pubscrname = SPOT' ,CONFIRM)
  127.  
  128.    IF CONFIRM = 1 THEN DO               /* Pressed OK       */
  129.             DROP CONFIRM
  130.             CALL CLOSE('REQ_TEXT')
  131.             IF EXISTS('T:ReqText.tmp') THEN DO
  132.                 IF FILES_BUNDLED = 1 THEN DO
  133.                      address command
  134.                      Delete 't:ReqText.tmp' QUIET
  135.                      END
  136.                 END
  137.             ADDRESS
  138.             SIGNAL ALL_DONE
  139.             END
  140.    IF CONFIRM = 2 THEN DO               /* Pressed RESELECT */
  141.             DROP CONFIRM
  142.             CALL CLOSE('REQ_TEXT')
  143.             IF EXISTS('T:ReqText.tmp') THEN DO
  144.                 address command
  145.                 Delete 't:ReqText.tmp' QUIET
  146.                 END
  147.             SIGNAL START
  148.             END
  149.    IF CONFIRM = 0 THEN DO               /* Pressed ABORT    */
  150.             DROP CONFIRM
  151.             CALL CLOSE('REQ_TEXT')
  152.             IF EXISTS('T:ReqText.tmp') THEN DO
  153.                      address command
  154.                      Delete 't:ReqText.tmp' QUIET
  155.                      END
  156.                 END
  157.             CALL FINISHED
  158.             SIGNAL COMMENCE
  159.             END
  160.  
  161.  
  162. END
  163.  
  164. ALL_DONE:
  165.  
  166. list = ALL_FILES
  167. total = files.count
  168.  
  169. /************************************************************************/
  170. /*************  Begin extraction and searching routine ******************/
  171. /************************************************************************/
  172.  
  173. ADDRESS SPOT
  174. options results
  175.  
  176. 'progressopen TITLE "Searching..." PROMPT "  "'
  177. preq = result
  178.  
  179. misses = 0
  180. hits = 0
  181.  
  182. DO i= 1 to total
  183.  
  184.   fullfile =  word(list,i)                                        /* Get name + full path */
  185.  
  186.   CALL Getfile(fullfile)                                          /* Extract name only via 'Getfile'  */
  187.                                                                   /* returned in variable 'file'      */
  188. 'progressupdate' preq i total PROMPT "..."||file
  189. IF rc = 5 THEN DO
  190.       SEARCH_ABORT = 1
  191.       CALL FINISHED
  192.       SIGNAL COMMENCE
  193.       END
  194. CALL Checkbbs                                                     /* Check the BBS list               */
  195. CALL Checklog                                                     /* Check the log file               */
  196.  
  197.    IF CHECK_LIST = 0 THEN DO              /* If not found, add to list   */
  198.       CALL WRITELN(fullpath,fullfile)     /* for archiving and for log.  */
  199.       CALL WRITELN(nopath,file)           /* Create the 'nopath' file    */
  200.       misses = misses + 1
  201.    END
  202.  
  203.    IF CHECK_LIST = 1 THEN DO         /* If found count as a 'hit'   */
  204.       call rtezrequest(file||" already held or uploaded..","OK","Dupe report..","rt_pubscrname=SPOT")
  205.       hits = hits +1
  206.    END
  207.  
  208.  
  209. END
  210.  
  211. 'progressclose' preq
  212.  
  213. /************************************************************************/
  214. /******************  Report any duplicates found ************************/
  215. /************************************************************************/
  216.  
  217. SELECT
  218. WHEN hits = 0 THEN call rtezrequest("No duplicates found", " Continue " , "Search report.." , "rt_pubscrname=SPOT")
  219. WHEN hits =  total THEN DO
  220.            call rtezrequest("All files already held or uploaded", " Exit " ,,"rt_pubscrname=SPOT")
  221.            CALL FINISHED
  222.            SIGNAL COMMENCE
  223.            END
  224. WHEN hits > 1 THEN call rtezrequest(hits||" duplicates found.." , " OK " , "Dupe report.." , "rt_pubscrname=SPOT")
  225. WHEN hits == 1 THEN call rtezrequest("1 duplicate found"," OK " , "Dupe report.." , "rt_pubscrname=SPOT")
  226. END
  227.  
  228. /************************************************************************/
  229. /*********************  Start archiving options *************************/
  230. /************************************************************************/
  231.  
  232. arcname = rtgetstring(PREFS.10,'Enter a name for the archive...',misses||" files for archiving",'OK|ABORT',"rt_pubscrname=SPOT")
  233. IF arcname == "" THEN DO
  234.            CALL FINISHED
  235.            SIGNAL COMMENCE
  236.            END
  237. DROP RESPONSE
  238. CALL rtgetstring(PREFS.11,arcname||'.lha will be placed in your '||PREFS.11||' directory.','Begin archiving..','OK|CHANGE DIRECTORY|ABORT',"rt_pubscrname=SPOT",RESPONSE)
  239. IF RESPONSE = 0 THEN DO
  240.         CALL FINISHED
  241.         SIGNAL COMMENCE
  242.         END
  243. IF RESPONSE = 2 THEN DO
  244.         DROP RESPONSE
  245.         PREFS.11 = rtfilerequest(,,'Pick volume',,'rtfi_flags = freqf_nofiles rt_pubscrname=SPOT')
  246.         END
  247. /************************************************************************/
  248. /*********************** Make log of files archived *********************/
  249. /************************************************************************/
  250.  
  251. CALL SEEK(nopath,0,BEGIN)           /* Go to start of 'nopath' file  */
  252. DO FOREVER
  253.     sendfile = READLN(nopath)       /* Read each file in turn        */
  254.     IF EOF(nopath) = 1 THEN LEAVE   /* If end of the file then leave */
  255.     CALL WRITELN(log,sendfile)      /* Write the filename to the log */
  256. END                                 /* Finished                      */
  257. CALL CLOSE(nopath)                  /* Close the 'nopath' file       */
  258. CALL WRITELN(log,'+------------------+')
  259.  
  260. /************************************************************************/
  261. /********************* Commence archiving *******************************/
  262. /************************************************************************/
  263.  
  264. CALL CLOSE(fullpath)
  265.  
  266. ADDRESS command
  267. 'lha -I a 'PREFS.11||arcname' @T:fullpath.tmp'
  268.  
  269. ADDRESS
  270. IF EXISTS('T:fullpath.tmp') THEN DO
  271.    ADDRESS COMMAND
  272.    Delete 't:fullpath.tmp' QUIET
  273.    END
  274.  
  275. /************************************************************************/
  276. /********************* Write message for file attach ********************/
  277. /************************************************************************/
  278.  
  279. ADDRESS SPOT
  280. UPLOAD_BANNER = 'Bulk upload from 'PREFS.3' @ 'PREFS.5' to 'PREFS.7
  281. CALL OPEN(nopath,'T:nopath.tmp',READ)    /* Open 'nopath' file for reading*/
  282. CALL OPEN(message,'T:message.tmp',WRITE)
  283. CALL WRITELN(message,UPLOAD_BANNER)
  284. CALL WRITELN(message,NL)
  285.  
  286. /************************************************************************/
  287. /************  Compile text file of files + descriptions ************** */
  288. /************************************************************************/
  289.  
  290. CALL SEEK(nopath,0,BEGIN)           /* Go to the start of 'nopath' file */
  291. DO FOREVER
  292.        FILE = READLN(nopath)        /* Read each file from 'nopath'     */
  293.        IF EOF(nopath) THEN DO       /* If end of 'nopath' reached then  */
  294.             CALL CLOSE(nopath)      /* delete it and leave              */
  295.             ADDRESS COMMAND
  296.             'DELETE t:nopath.tmp QUIET'
  297.             ADDRESS
  298.             LEAVE
  299.             END
  300.        DESC = rtgetstring(,'Enter description for 'FILE,'Bundle.spot','OK' ,'rt_pubscrname = SPOT',)
  301.        CALL WRITELN(message,FILE'............'DESC)
  302.        CALL WRITELN(message,NL)
  303. END  
  304.  
  305. CALL CLOSE(message)
  306.  
  307. /************************************************************************/
  308. /******************** Write the message to the Sysop ********************/
  309. /************************************************************************/
  310.  
  311. gotoarea PREFS.12
  312. messages
  313.  
  314. subj_line = PREFS.11||arcname||'.lha'
  315. temp_file = 'T:message.tmp'
  316.  
  317. 'write TO "'PREFS.4'" TOADDR "'PREFS.6'" FROM "'PREFS.3'" SUBJECT "'subj_line'" FILE 'temp_file' NOEDIT NOGUI NOSIG'
  318.  
  319. lastmessage
  320. setflags FILEATTACH
  321.  
  322. CALL FINISHED
  323. ADDRESS COMMAND
  324. DELETE 'T:message.tmp' QUIET
  325. ADDRESS
  326. FILES_BUNDLED = 1
  327. SIGNAL COMMENCE
  328.  
  329. /************************************************************************/
  330. /****************************  THE PREFS EDITOR *************************/
  331. /************************************************************************/
  332.  
  333. MAIN_PREFS:
  334.  
  335. /*************************************************************************/
  336. /**** Read the contents of the prefs file into the 'PREFS.' variable *****/
  337. /* If NO current prefs file then assign NULL string to PREFS.1 - PREFS.13*/
  338. /*************************************************************************/
  339.  
  340. IF ~EXISTS('S:BUNDLE.PREFS') THEN DO
  341.         CALL rtezrequest('Cannot find S:BUNDLE.prefs,'NL'do you wish to create a new file?','OK|QUIT','Bundle.prefs','rtez_flags = ezreqf_centertext',)
  342.             IF rtresult = 0 THEN DO
  343.             CALL FINISHED
  344.             SIGNAL COMMENCE
  345.             END
  346.                DO i = 1 to 13
  347.                PREFS.i = ""
  348.                END
  349.             SIGNAL MAIN
  350.         END
  351.  
  352. CALL READ_IN
  353.  
  354. /*************************************************************************/
  355. /* Advise if current settings found and give option to edit or creat new */
  356. /*************************************************************************/
  357.  
  358. CALL rtezrequest('S:BUNDLE.prefs found.'NL'Do you wish to edit current'NL'file or create a new prefs file?','EDIT|NEW|LEAVE','Bundle.prefs','rtez_flags = ezreqf_centertext',)
  359.  
  360. IF rtresult = 2 THEN DO           /*    File exists but selected "NEW"    */
  361.               SIGNAL MAIN         /* Therefore DON'T set 'NEW_PREFS' flag */
  362.               END
  363. IF rtresult = 1 THEN SIGNAL EDIT      /* Pressed "EDIT"  */
  364. IF rtresult = 0 THEN SIGNAL COMMENCE  /* Pressed "LEAVE" */
  365.  
  366. /*************************************************************************/
  367. /******************* CHOOSE WHICH SETTING(S) TO EDIT *********************/
  368. /*************************************************************************/
  369.  
  370. EDIT:   /*   The Reqrexxtools 'rtlong' requester  */
  371.  
  372. CUR_SET = "Enter the number of the item you wish to edit.."||NL
  373.  
  374. DO i = 1 to 13
  375.   CUR_SET = CUR_SET||NL||"("i")      "||WORD(VAR_STRING,i)"    =    "||PREFS.i
  376. END
  377.  
  378. number=rtgetlong(,VALUE('CUR_SET'),'Bundle.prefs','FINISHED','rtgl_min = 1 rtgl_max = 13',)
  379.  
  380.  
  381. IF number = "" THEN DO
  382.     EDIT_MARKER = 0
  383.     CALL WRITE_PREFS             /* Nothing entered..pass save routine */
  384.     END
  385. IF number > 0 THEN DO            /* Pass to specific prefs routine     */
  386.     EDIT_MARKER = 1
  387.     OLD_SETTING.number = PREFS.number
  388.     SIGNAL VALUE('PREFS_'||number)
  389.     END
  390. ELSE DO
  391.    EDIT_MARKER = 0
  392.    SIGNAL COMMENCE               /* Else go back to 'commence'         */
  393.    END
  394.  
  395. /*************************************************************************/
  396. /*************** The individual PREFS editors, numbered 1 -13 ************/
  397. /*************************************************************************/
  398.  
  399. MAIN:
  400.  
  401. IF CUR_PREFS ~= 1 THEN DO
  402.              DO i = 1 to 13
  403.              PREFS.i = ""
  404.              END
  405.              END
  406.  
  407. PREFS_1:
  408. MARKER = 1
  409. CALL rtezrequest('Where can I find SPOT?..','Take me there..','Bundle.prefs','rtez_flags = ezreqf_centertext',)
  410. PREFS.1 = rtfilerequest('SPOT:',,'Bundle.prefs','OK','rtfi_flags = freqf_nofiles',)
  411. IF PREFS.1 == "" THEN DO
  412.              STEP = PREFS_1
  413.              CALL CHECK_QUIT
  414.              END
  415. IF ~EXISTS(PREFS.1||'SPOT') THEN DO
  416.              CALL rtezrequest('Cannot find SPOT there..','Try again','ERROR',,)
  417.              SIGNAL PREFS_1
  418.              END
  419.  
  420. CALL ED_CHECK
  421.  
  422. PREFS_2:
  423. MARKER = 2
  424. CALL rtezrequest('Where can I find SPOT.prefs?..','Take me there..','Bundle.prefs','rtez_flags = ezreqf_centertext',)
  425. PREFS.2 = rtfilerequest('SPOT:',,'Bundle.prefs','OK','rtfi_flags = freqf_nofiles',)
  426. IF PREFS.2 == "" THEN DO
  427.              STEP = PREFS_2
  428.              CALL CHECK_QUIT
  429.              END
  430. IF ~EXISTS(PREFS.2||'SPOT.prefs') THEN DO
  431.              CALL rtezrequest('Cannot find SPOT.prefs there..','Try again','ERROR',,)
  432.              SIGNAL PREFS_2
  433.              END 
  434.  
  435. CALL ED_CHECK
  436.  
  437. PREFS_3:
  438. MARKER = 3
  439. PREFS.3 = rtgetstring(PREFS.3,'Enter your full name..','Bundle.prefs','OK|CANCEL',,)
  440. IF PREFS.3 == "" THEN DO
  441.              STEP = PREFS_3
  442.              CALL CHECK_QUIT
  443.              END
  444. CALL ED_CHECK
  445.  
  446. PREFS_4:
  447. MARKER = 4
  448. PREFS.4 = rtgetstring(PREFS.4,'Enter your bosses full name..','Bundle.prefs','OK|CANCEL',,)
  449. IF PREFS.4 == "" THEN DO
  450.              STEP = PREFS_4
  451.              CALL CHECK_QUIT
  452.              END
  453. CALL ED_CHECK
  454.  
  455. PREFS_5:
  456. MARKER = 5
  457. PREFS.5 = rtgetstring(PREFS.5,'Enter your full 4D Fido address'NL'(e.g. 2:440/7.19)','Bundle.prefs','OK|CANCEL',,)
  458. IF PREFS.5 == "" THEN DO
  459.              STEP = PREFS_5
  460.              CALL CHECK_QUIT
  461.              END
  462. IF INDEX(PREFS.5,":")=0|INDEX(PREFS.5,"/")=0|INDEX(PREFS.5,".")=0 THEN DO
  463.              CALL rtezrequest('That is not a full 4D Fido address..','Try again','ERROR',,)
  464.              SIGNAL PREFS_5
  465.              END
  466.  
  467. CALL ED_CHECK
  468.  
  469.  
  470.  
  471.  
  472. PREFS_6:
  473. MARKER = 6
  474. PREFS.6 = rtgetstring(PREFS.6,'Enter your Bosses full 4D Fido address'NL'(e.g. 2:440/7.0)','Bundle.prefs','OK|CANCEL',,)
  475. IF PREFS.6 == "" THEN DO
  476.              STEP = PREFS_6
  477.              CALL CHECK_QUIT
  478.              END
  479. IF INDEX(PREFS.6,":")=0|INDEX(PREFS.6,"/")=0|INDEX(PREFS.6,".")=0 THEN DO
  480.              CALL rtezrequest('That is not a full 4D Fido address..','Try again','ERROR',,)
  481.              SIGNAL PREFS_6
  482.              END   
  483.  
  484. CALL ED_CHECK
  485.  
  486.  
  487.  
  488. PREFS_7:
  489. MARKER = 7
  490. PREFS.7 = rtgetstring(PREFS.7,'Enter the full name of your BBS..','Bundle.prefs','OK|CANCEL',,)
  491. IF PREFS.7 == "" THEN DO
  492.              STEP = PREFS_7
  493.              CALL CHECK_QUIT
  494.              END
  495. CALL ED_CHECK
  496.  
  497.  
  498.  
  499. PREFS_8:
  500. MARKER = 8
  501. CALL rtezrequest('Now you must select a file list'NL'for Bundle.spot to search..','OK','Bundle.prefs','rtez_flags = ezreqf_centertext',)
  502. PREFS.8 = rtfilerequest(,,'Bundle.prefs','OK',,)
  503. IF ~EXISTS(PREFS.8) THEN DO
  504.              CALL rtezrequest('Cannot find the specified file list...','Try again','ERROR',,)
  505.              SIGNAL PREFS_8
  506.              END
  507. IF PREFS.8 == "" THEN DO
  508.              STEP = PREFS_8
  509.              CALL CHECK_QUIT
  510.              END
  511. CALL ED_CHECK
  512.  
  513.  
  514.  
  515. PREFS_9:
  516. MARKER = 9
  517. CALL rtezrequest('Now you must select the default directory'NL'from which to select your files..','OK','Bundle.prefs','rtez_flags = ezreqf_centertext',)
  518. PREFS.9 = rtfilerequest(,,'Bundle.prefs','OK','rtfi_flags = freqf_nofiles',)
  519. IF PREFS.9 == "" THEN DO
  520.              STEP = PREFS_9
  521.              CALL CHECK_QUIT
  522.              END
  523. CALL ED_CHECK
  524.  
  525.  
  526.  
  527. PREFS_10:
  528. MARKER = 10
  529. PREFS.10 = rtgetstring(PREFS.10,'Enter a default name for your archived files..','Bundle.prefs','OK|CANCEL',,)
  530. PREFS.10 = COMPRESS(PREFS.10)
  531. IF PREFS.10 == "" THEN DO
  532.              STEP = PREFS_10
  533.              CALL CHECK_QUIT
  534.              END
  535. CALL ED_CHECK
  536.  
  537.  
  538.  
  539. PREFS_11:
  540. MARKER = 11
  541. CALL rtezrequest('Now you must select the default directory'NL'in which to place the archived files..','OK','Bundle.prefs','rtez_flags = ezreqf_centertext',)
  542. PREFS.11 = rtfilerequest(,,'Bundle.prefs','OK','rtfi_flags = freqf_nofiles',)
  543. IF PREFS.11 == "" THEN DO
  544.              STEP = PREFS_11
  545.              CALL CHECK_QUIT
  546.              END
  547. CALL ED_CHECK
  548.  
  549.  
  550.  
  551. PREFS_12:
  552. MARKER = 12
  553. PREFS.12 = rtgetstring(PREFS.12,'Now enter the Fidonet Netmail area in which'NL,
  554.                         'to address the message to your boss.'NL,
  555.                         '*THIS MUST BE EXACTLY AS IT APPEARS IN SPOT*'NL,
  556.                         '*AND SHOULD ALSO BE A NETMAIL/MATRIX AREA*'NL,
  557.                         'If you wish I will start SPOT and allow you'NL,
  558.                         'to select it from there..','Bundle.prefs','OK|START SPOT|CANCEL','rtez_flags = ezreqf_centertext',)
  559. IF rtresult = 2 THEN CALL START_SPOT
  560. IF PREFS.12 == "" THEN DO
  561.              STEP = PREFS_12
  562.              CALL CHECK_QUIT
  563.              END
  564. CALL ED_CHECK
  565.  
  566.  
  567.  
  568. PREFS_13:
  569. MARKER = 13
  570. CALL rtezrequest('Now you must select a directory and'NL'enter a name for your log file.'NL'The default is S:Bundle.log','OK','Bundle.prefs','rtez_flags = ezreqf_centertext',)
  571. PREFS.13 = rtfilerequest('S:','Bundle.log','Bundle.prefs','OK',,)
  572. IF PREFS.13 == "" THEN DO
  573.              STEP = PREFS_13
  574.              CALL CHECK_QUIT
  575.              END
  576. CALL ED_CHECK
  577.  
  578. /*************************************************************************/
  579. /************* Write the PREFS settings to S:BUNDLE.prefs ****************/
  580. /*************************************************************************/
  581.  
  582. CALL WRITE_PREFS
  583. CALL rtezrequest('Bundle.prefs finished, you are now free'NL'to enjoy the delights of Bundle.spot!','EXIT','Goodbye from Bundle.prefs!','rtez_flags = ezreqf_centertext',)
  584.  
  585. SIGNAL READ_IN
  586.  
  587. /*************************************************************************/
  588. /********************* PREFS EDITOR PROCEDURES ***************************/
  589. /*************************************************************************/
  590. READ_IN:
  591.  
  592.     CALL OPEN('PREFS_FILE','S:Bundle.prefs',READ)
  593.     i = 1
  594.     DO FOREVER
  595.       ITEM =  READLN('PREFS_FILE')
  596.       SELECT
  597.         WHEN INDEX(ITEM,"#") THEN ITERATE
  598.         WHEN EOF('PREFS_FILE') THEN LEAVE
  599.         WHEN ITEM = "" THEN ITERATE
  600.         OTHERWISE NOP
  601.       END
  602.    PREFS.i = ITEM
  603.    i = i + 1
  604.    END
  605. CALL CLOSE('PREFS_FILE')
  606.  
  607. /*  IF CORRUPT  */
  608.  
  609. IF i ~= 14 THEN DO
  610.       CORRUPT = 1
  611.       EDIT_MARKER = 0
  612.       CALL rtezrequest("*ERROR*"NL,
  613.                        "S:Bundle.prefs appears corrupt"NL,
  614.                        "Please run Prefs editor to create"NL,
  615.                        "a new Prefs file.","OK","ERROR in S:Bundle.prefs","rtez_flags = ezreqf_centertext",)
  616.               DO i = 1 to 13
  617.               PREFS.i = ""
  618.               END
  619.       SIGNAL MAIN
  620.       END
  621. RETURN
  622.  
  623.         
  624.  
  625.  
  626. ED_CHECK:
  627. IF EDIT_MARKER = 1 THEN DO
  628.         EDIT_MARKER = 0
  629.         SIGNAL EDIT
  630.         END
  631. ELSE RETURN
  632.  
  633.  
  634.  
  635. WRITE_PREFS:
  636. CALL rtezrequest("Save settings to S:Bundle.prefs?","YES PLEASE|NO THANKS","Bundle.spot","rtez_flags=ezreqf_centertext",)
  637. IF rtresult = 0 THEN SIGNAL COMMENCE
  638. CALL OPEN('PREFS_FILE','S:Bundle.prefs',WRITE)
  639. DO i = 1 to 13
  640. CALL WRITELN('PREFS_FILE',"#"WORD(VAR_STRING,i))
  641. CALL WRITELN('PREFS_FILE',PREFS.i)
  642. END
  643. CALL CLOSE('PREFS_FILE')
  644. CALL rtezrequest('Settings saved to S:BUNDLE.prefs..','OK' ,'Bundle.Prefs',,)
  645. DROP NEW_PREFS
  646. DROP CORRUPT
  647. SIGNAL COMMENCE
  648. RETURN
  649.  
  650.  
  651. CHECK_QUIT:
  652. DROP CONFIRM
  653. CALL rtezrequest('You entered nothing..'||NL||'Leave or try again?','Again|Leave','Bundle.prefs',,CONFIRM)
  654.  
  655.  
  656.  
  657. IF CONFIRM = 1 & CORRUPT = 1 THEN DO           /* Pressed 'AGAIN' & flagged  */
  658.             SIGNAL VALUE(STEP)                 /* 'corrupt'                  */
  659.             END  
  660. IF CONFIRM = 0 & CORRUPT = 1 THEN DO           /* Pressed 'LEAVE' & flagged  */
  661.             CALL FINISHED                      /* 'corrupt'                  */
  662.             SIGNAL COMMENCE
  663.             END
  664. IF CONFIRM = 1 & EDIT_MARKER = 1 THEN DO       /* Pressed 'AGAIN' and called */
  665.             PREFS.MARKER = OLD_SETTING.MARKER  /* From 'EDIT'                */
  666.             DROP EDIT_MARKER
  667.             SIGNAL VALUE(STEP)
  668.             END
  669. IF CONFIRM = 0 & EDIT_MARKER = 1 THEN DO       /* Pressed 'LEAVE' and called */
  670.             PREFS.MARKER = OLD_SETTING.MARKER  /* From 'EDIT'                */
  671.             DROP EDIT_MARKER
  672.             SIGNAL EDIT
  673.             END
  674. IF CONFIRM = 1 & NEW_PREFS = 1 THEN DO         /* Pressed 'AGAIN' and called */
  675.             SIGNAL VALUE(STEP)                 /* from "NEW"                 */
  676.             END   
  677. IF CONFIRM = 0 & NEW_PREFS = 1 THEN DO         /* Pressed 'LEAVE' and called */
  678.             CALL FINISHED                      /* from 'NEW'                 */
  679.             EXIT
  680.             END
  681. IF CONFIRM = 1 THEN DO                         /* Pressed 'AGAIN'            */
  682.             SIGNAL VALUE(STEP)
  683.             END
  684. IF CONFIRM = 0 THEN DO                         /* Pressed 'LEAVE'            */
  685.             CALL FINISHED
  686.             SIGNAL COMMENCE
  687.             END
  688. RETURN
  689.  
  690.  
  691.  
  692.  
  693. START_SPOT:
  694. SPOT_EXE =  PREFS.1||"Spot"
  695.  
  696. IF ~SHOW('ports','SPOT') THEN DO
  697.   ADDRESS COMMAND
  698.   'RUN 'SPOT_EXE' CONFIGPATH '||PREFS.2
  699.   'WaitForPort SPOT'
  700.   QUIT = YES
  701. END
  702.  
  703. ADDRESS 'SPOT'
  704. OPTIONS RESULTS
  705. 'isiconified'
  706. IF RC = 0 THEN DO
  707.   ICON = YES
  708.   'uniconify'
  709. END
  710. 'spot2front'
  711. 'isarealist'
  712. IF RC = 5 THEN DO
  713.   'arealist'
  714. END
  715.  
  716. 'requestarea TITLE "Bundle.prefs" ALL'
  717. PREFS.12 = RESULT
  718. IF ICON = YES THEN DO
  719.      'ICONIFY NOREQ NOSAVE'
  720.      END
  721. IF QUIT = YES THEN DO
  722.      'QUITSPOT NOREQ NOSAVE'
  723.      END
  724. RETURN  
  725.  
  726.  
  727. /************************************************************************/
  728. /****************************  BUNDLE PROCEDURES ************************/
  729. /************************************************************************/
  730.  
  731. ABOUT:
  732. CALL rtezrequest("BUNDLE.spot Version 1.3"NL,
  733.                  "by Steve Collins"NL,
  734.                  "30-4-1995"NL NL,
  735.                  "If you find this script useful "NL,
  736.                  "OR"NL,
  737.                  "you want to report a bug then"NL,
  738.                  "please drop me a line at either.."NL NL,
  739.                  "email- steve@stuffs.demon.co.uk"NL,
  740.                  "or"NL,
  741.                  "Fidonet- 2:257/99.3 or 2:440/7.19"NL NL,
  742.                  "..and I'll also let you know of all updates"NL NL,
  743.                  "Thanks.....","OK","BUNDLE.spot","rtez_flags=ezreqf_centertext",)
  744. SIGNAL COMMENCE
  745.  
  746. CHECKBBS:
  747.     CHECK_LIST = 0
  748.     CALL SEEK(BBS,0,BEGIN)       /*  Check the BBS list  */
  749.     DO WHILE EOF(BBS) ~= 1
  750.        text= READLN(BBS)
  751.               IF INDEX(text,file) ~= 0 THEN DO
  752.               CHECK_LIST = 1
  753.               LEAVE
  754.               END
  755.     END
  756.     RETURN
  757.  
  758. CHECKLOG:
  759.     CALL SEEK(log,0,BEGIN)      /*  Check the upload log */
  760.     DO WHILE EOF(log) ~= 1
  761.       text = READLN(log)
  762.              IF INDEX(text,file) ~= 0 THEN DO
  763.              CHECK_LIST = 1
  764.              LEAVE
  765.              END
  766.     END
  767.     RETURN
  768.  
  769. GETFILE:
  770.     hit = LASTPOS(':',fullfile)
  771.     IF hit ~== 0 THEN file=DELSTR(fullfile,1,hit)
  772.     hit = LASTPOS('/',file)
  773.     IF hit ~== 0 THEN file=DELSTR(file,1,hit)
  774.     RETURN file
  775.  
  776. STAMPLOG:
  777.     DATE_STAMP = date()
  778.     TIME_STAMP = time('C')
  779.     IF EXISTS(PREFS.13) THEN DO
  780.        CALL OPEN(log,PREFS.13,APPEND)
  781.        CALL WRITELN(log,'Bundle.rexx started on 'DATE_STAMP' at 'TIME_STAMP)
  782.        END
  783.     ELSE DO
  784.        CALL OPEN(log,PREFS.13,WRITE)
  785.        CALL WRITELN(log,'New log started-'DATE_STAMP' at 'TIME_STAMP)
  786.        END 
  787.     RETURN
  788.  
  789.  
  790. FINISHED:
  791. FAILURE:
  792.  
  793. IF STAMP = 1 THEN DO
  794.    DROP STAMP
  795.    CALL SEEK(log,0,END)
  796.    CALL WRITELN(log,'+------------------+')
  797.    END
  798.  
  799. DROP total
  800. DROP hits
  801. DROP misses
  802. DROP ALL_FILES
  803.  
  804. CALL CLOSE('fullpath')
  805. CALL CLOSE('nopath')
  806.  
  807. IF FILES_BUNDLED = 1 THEN DO
  808.       IF EXISTS('T:nopath.tmp') THEN DO
  809.         address command
  810.         Delete 't:nopath.tmp' QUIET
  811.         END
  812.      IF EXISTS('T:fullpath.tmp') THEN DO
  813.         address command
  814.         Delete 't:fullpath.tmp' QUIET
  815.         END
  816.      IF EXISTS('T:ReqText.tmp') THEN DO
  817.         address command
  818.         Delete 't:ReqText.tmp' QUIET
  819.         END
  820. FILES_BUNDLED = 0
  821. END
  822.  
  823.  
  824. ADDRESS SPOT
  825. IF SHOW('PORTS','SPOT') THEN DO
  826.    ADDRESS SPOT
  827.     'unlockgui'
  828.     IF PREQ ~= 'PREQ' THEN
  829.     'progressclose' PREQ    
  830.  
  831.    DROP response
  832.     IF ICON == "YES" THEN DO
  833.       DROP ICON
  834.       CALL rtezrequest("Re-iconify Spot?","Iconify|Don't Iconify","Bundle.spot finished..","rt_pubscrname=SPOT",response)
  835.            IF response = 1 THEN iconify NOREQ NOSAVE
  836.            ELSE SIGNAL COMMENCE
  837.            END
  838.     IF QUIT == "YES" THEN DO
  839.       DROP QUIT
  840.       CALL rtezrequest("Quit Spot?","Quit|Don't Quit","Bundle.spot finished..","rt_pubscrname=SPOT",response)
  841.            IF response = 1 THEN quitspot NOREQ NOSAVE
  842.            ELSE SIGNAL COMMENCE
  843.            END
  844. END
  845.  
  846. RETURN
  847.  
  848. SYNTAX:
  849. SAY '*SYNTAX ERROR*' C ERRORTEXT(RC) 'IN LINE' SIGL
  850. RETURN
  851.  
  852.  
  853.  
  854.  
  855.  
  856.  
  857.  
  858.  
  859.  
  860.